home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / MapInfo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  2.2 KB  |  94 lines

  1. // MapInfo.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Radiant.h"
  6. #include "MapInfo.h"
  7. #include "qe3.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMapInfo dialog
  17.  
  18.  
  19. CMapInfo::CMapInfo(CWnd* pParent /*=NULL*/)
  20.     : CDialog(CMapInfo::IDD, pParent)
  21. {
  22.     //{{AFX_DATA_INIT(CMapInfo)
  23.     m_nNet = 0;
  24.     m_nTotalBrushes = 0;
  25.     m_nTotalEntities = 0;
  26.     //}}AFX_DATA_INIT
  27. }
  28.  
  29.  
  30. void CMapInfo::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CDialog::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CMapInfo)
  34.     DDX_Control(pDX, IDC_LIST_ENTITIES, m_lstEntity);
  35.     DDX_Text(pDX, IDC_EDIT_NET, m_nNet);
  36.     DDX_Text(pDX, IDC_EDIT_TOTALBRUSHES, m_nTotalBrushes);
  37.     DDX_Text(pDX, IDC_EDIT_TOTALENTITIES, m_nTotalEntities);
  38.     //}}AFX_DATA_MAP
  39. }
  40.  
  41.  
  42. BEGIN_MESSAGE_MAP(CMapInfo, CDialog)
  43.     //{{AFX_MSG_MAP(CMapInfo)
  44.     //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CMapInfo message handlers
  49.  
  50. BOOL CMapInfo::OnInitDialog() 
  51. {
  52.     CDialog::OnInitDialog();
  53.  
  54.   m_nTotalBrushes = 0;
  55.   m_nTotalEntities = 0;
  56.   m_nNet = 0;
  57.     for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next)
  58.   {
  59.     m_nTotalBrushes++;
  60.     if (pBrush->owner == world_entity)
  61.       m_nNet++;
  62.   }
  63.  
  64.  
  65.   CMapStringToPtr mapEntity;
  66.  
  67.   int nValue = 0;
  68.     for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
  69.     {
  70.     m_nTotalEntities++;
  71.     nValue = 0;
  72.     mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(nValue));
  73.     nValue++ ;
  74.     mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void*>(nValue));
  75.   }
  76.  
  77.   m_lstEntity.ResetContent();
  78.   m_lstEntity.SetTabStops(96);
  79.   CString strKey;
  80.   POSITION pos = mapEntity.GetStartPosition();
  81.   while (pos)
  82.   {
  83.     mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast<void*&>(nValue));
  84.     CString strList;
  85.     strList.Format("%s\t%i", strKey, nValue);
  86.     m_lstEntity.AddString(strList);
  87.   }
  88.  
  89.   UpdateData(FALSE);
  90.     
  91.     return TRUE;  // return TRUE unless you set the focus to a control
  92.                   // EXCEPTION: OCX Property Pages should return FALSE
  93. }
  94.